# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=adriconf
pkgver=2.5.1
pkgrel=1
pkgdesc="GUI tool to configure Mesa drivers by setting options and writing them to the standard drirc file"
arch=(loong64 x86_64)
url="https://gitlab.freedesktop.org/mesa/adriconf"
license=(GPL3)
depends=(gtkmm3 pciutils pugixml)
makedepends=(cmake)
source=(https://gitlab.freedesktop.org/mesa/$pkgname/-/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha256sums=('3940acc54c7a72cb2cc213064bbbff4593f9878624e3f57b0288fb4112f31592')

build() {
  cmake -B build -S $pkgname-v$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_UNIT_TESTS=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dm644 $pkgname-v$pkgver/flatpak/org.freedesktop.adriconf.metainfo.xml \
    "$pkgdir/usr/share/metainfo/org.freedesktop.adriconf.metainfo.xml"
  install -Dm644 $pkgname-v$pkgver/flatpak/org.freedesktop.adriconf.desktop \
    "$pkgdir/usr/share/applications/org.freedesktop.adriconf.desktop"
  install -Dm644 $pkgname-v$pkgver/flatpak/org.freedesktop.adriconf.png \
    "$pkgdir/usr/share/icons/hicolor/256x256/apps/org.freedesktop.adriconf.png"
}
